<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>vue中使用vue-quill-editor富文本编辑器及自定义工具栏 | 눈_눈？</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/favicon.ico">
    <meta name="description" content="雨润三江水,一任五更寒">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.39493abb.css" as="style"><link rel="preload" href="/assets/js/app.f4a44a18.js" as="script"><link rel="preload" href="/assets/js/3.48232c0c.js" as="script"><link rel="preload" href="/assets/js/1.1ffd113d.js" as="script"><link rel="preload" href="/assets/js/49.fa7ab119.js" as="script"><link rel="prefetch" href="/assets/js/10.3ca9dec1.js"><link rel="prefetch" href="/assets/js/11.874c1055.js"><link rel="prefetch" href="/assets/js/12.ba64ad86.js"><link rel="prefetch" href="/assets/js/13.567f7e2c.js"><link rel="prefetch" href="/assets/js/14.a883120b.js"><link rel="prefetch" href="/assets/js/15.f0f48289.js"><link rel="prefetch" href="/assets/js/16.665ca6bd.js"><link rel="prefetch" href="/assets/js/17.9e5d8903.js"><link rel="prefetch" href="/assets/js/18.f72895dc.js"><link rel="prefetch" href="/assets/js/19.2a106cc2.js"><link rel="prefetch" href="/assets/js/20.4c0d7dc8.js"><link rel="prefetch" href="/assets/js/21.6771e3a2.js"><link rel="prefetch" href="/assets/js/22.f3c7aad6.js"><link rel="prefetch" href="/assets/js/23.60529100.js"><link rel="prefetch" href="/assets/js/24.7d50cb5e.js"><link rel="prefetch" href="/assets/js/25.58231492.js"><link rel="prefetch" href="/assets/js/26.3067a077.js"><link rel="prefetch" href="/assets/js/27.b167830e.js"><link rel="prefetch" href="/assets/js/28.f5722284.js"><link rel="prefetch" href="/assets/js/29.62d2e4fe.js"><link rel="prefetch" href="/assets/js/30.c2afa3b0.js"><link rel="prefetch" href="/assets/js/31.d7dde24d.js"><link rel="prefetch" href="/assets/js/32.4e2b272d.js"><link rel="prefetch" href="/assets/js/33.5e4d7960.js"><link rel="prefetch" href="/assets/js/34.8d5624e0.js"><link rel="prefetch" href="/assets/js/35.abd48ffb.js"><link rel="prefetch" href="/assets/js/36.e231ea32.js"><link rel="prefetch" href="/assets/js/37.e99c1b8f.js"><link rel="prefetch" href="/assets/js/38.ff825294.js"><link rel="prefetch" href="/assets/js/39.b3321103.js"><link rel="prefetch" href="/assets/js/4.936c6377.js"><link rel="prefetch" href="/assets/js/40.8e915e21.js"><link rel="prefetch" href="/assets/js/41.9a5c6a3d.js"><link rel="prefetch" href="/assets/js/42.2159b3c3.js"><link rel="prefetch" href="/assets/js/43.144bc67d.js"><link rel="prefetch" href="/assets/js/44.c7b1a0a9.js"><link rel="prefetch" href="/assets/js/45.fafbd061.js"><link rel="prefetch" href="/assets/js/46.dfd415c1.js"><link rel="prefetch" href="/assets/js/47.d6285fa6.js"><link rel="prefetch" href="/assets/js/48.c3c90153.js"><link rel="prefetch" href="/assets/js/5.0bd232c4.js"><link rel="prefetch" href="/assets/js/50.6d5fe086.js"><link rel="prefetch" href="/assets/js/51.e0b9a5c9.js"><link rel="prefetch" href="/assets/js/52.39d71cb2.js"><link rel="prefetch" href="/assets/js/53.ad47bc0c.js"><link rel="prefetch" href="/assets/js/54.989d4596.js"><link rel="prefetch" href="/assets/js/55.fea0aaad.js"><link rel="prefetch" href="/assets/js/56.af246d88.js"><link rel="prefetch" href="/assets/js/57.747bce1d.js"><link rel="prefetch" href="/assets/js/58.8d177768.js"><link rel="prefetch" href="/assets/js/59.e97890fd.js"><link rel="prefetch" href="/assets/js/6.8aac6fc8.js"><link rel="prefetch" href="/assets/js/60.114e9ca6.js"><link rel="prefetch" href="/assets/js/7.f1ea8070.js"><link rel="prefetch" href="/assets/js/8.af678f34.js"><link rel="prefetch" href="/assets/js/9.a1b28891.js">
    <link rel="stylesheet" href="/assets/css/0.styles.39493abb.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div><div class="theme-container" data-v-e3b9d544><div data-v-e3b9d544><div id="loader-wrapper" class="loading-wrapper" data-v-1c4f0192 data-v-e3b9d544 data-v-e3b9d544><div class="loader-main" data-v-1c4f0192><div data-v-1c4f0192></div><div data-v-1c4f0192></div><div data-v-1c4f0192></div><div data-v-1c4f0192></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-071f7da2 data-v-e3b9d544 data-v-e3b9d544><h3 class="title" style="display:none;" data-v-071f7da2 data-v-071f7da2>눈_눈？</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-071f7da2 data-v-071f7da2><input type="password" value="" data-v-071f7da2> <span data-v-071f7da2>Konck! Knock!</span> <button data-v-071f7da2>OK</button></label> <div class="footer" style="display:none;" data-v-071f7da2 data-v-071f7da2><span data-v-071f7da2><i class="iconfont reco-theme" data-v-071f7da2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-071f7da2>vuePress-theme-reco</a></span> <span data-v-071f7da2><i class="iconfont reco-other" data-v-071f7da2></i> <a data-v-071f7da2>yykrlc</a></span> <span data-v-071f7da2><i class="iconfont reco-copyright" data-v-071f7da2></i> <a data-v-071f7da2>2021</a></span></div></div> <div class="hide" data-v-e3b9d544><header class="navbar" data-v-e3b9d544><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/head.png" alt="눈_눈？" class="logo"> <span class="site-name">눈_눈？</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/朗读/" class="nav-link"><i class="iconfont undefined"></i>
  朗读
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="iconfont undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Docker/" class="nav-link"><i class="iconfont undefined"></i>
  Docker
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="iconfont undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/sql/" class="nav-link"><i class="iconfont undefined"></i>
  sql
</a></li><li class="dropdown-item"><!----> <a href="/categories/其他/" class="nav-link"><i class="iconfont undefined"></i>
  其他
</a></li><li class="dropdown-item"><!----> <a href="/categories/Other/" class="nav-link"><i class="iconfont undefined"></i>
  Other
</a></li><li class="dropdown-item"><!----> <a href="/categories/python/" class="nav-link"><i class="iconfont undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/categories/Vue/" class="nav-link"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/categories/Css/" class="nav-link"><i class="iconfont undefined"></i>
  Css
</a></li><li class="dropdown-item"><!----> <a href="/categories/JavaScript/" class="nav-link"><i class="iconfont undefined"></i>
  JavaScript
</a></li><li class="dropdown-item"><!----> <a href="/categories/闲言碎语/" class="nav-link"><i class="iconfont undefined"></i>
  闲言碎语
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/tools/" class="nav-link"><i class="iconfont reco-document"></i>
  收藏
</a></div><div class="nav-item"><a href="/photo/" class="nav-link"><i class="iconfont reco-douyin"></i>
  画廊
</a></div><div class="nav-item"><a href="/friends/" class="nav-link"><i class="iconfont reco-friend"></i>
  关于
</a></div><div class="nav-item"><a href="/timeLine/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-e3b9d544></div> <aside class="sidebar" data-v-e3b9d544><div class="personal-info-wrapper" data-v-c115f482><img src="/assets/img/home-head.32578f7e.png" alt="hero" class="personal-img" data-v-c115f482> <h3 class="name" data-v-c115f482>yykrlc</h3> <div class="num" data-v-c115f482><div data-v-c115f482><h3 data-v-c115f482>44</h3> <h6 data-v-c115f482>文章</h6></div> <div data-v-c115f482><h3 data-v-c115f482>27</h3> <h6 data-v-c115f482>标签</h6></div></div> <hr data-v-c115f482></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  首页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      分类
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/categories/朗读/" class="nav-link"><i class="iconfont undefined"></i>
  朗读
</a></li><li class="dropdown-item"><!----> <a href="/categories/工具/" class="nav-link"><i class="iconfont undefined"></i>
  工具
</a></li><li class="dropdown-item"><!----> <a href="/categories/Docker/" class="nav-link"><i class="iconfont undefined"></i>
  Docker
</a></li><li class="dropdown-item"><!----> <a href="/categories/Linux/" class="nav-link"><i class="iconfont undefined"></i>
  Linux
</a></li><li class="dropdown-item"><!----> <a href="/categories/sql/" class="nav-link"><i class="iconfont undefined"></i>
  sql
</a></li><li class="dropdown-item"><!----> <a href="/categories/其他/" class="nav-link"><i class="iconfont undefined"></i>
  其他
</a></li><li class="dropdown-item"><!----> <a href="/categories/Other/" class="nav-link"><i class="iconfont undefined"></i>
  Other
</a></li><li class="dropdown-item"><!----> <a href="/categories/python/" class="nav-link"><i class="iconfont undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/categories/Vue/" class="nav-link"><i class="iconfont undefined"></i>
  Vue
</a></li><li class="dropdown-item"><!----> <a href="/categories/Css/" class="nav-link"><i class="iconfont undefined"></i>
  Css
</a></li><li class="dropdown-item"><!----> <a href="/categories/JavaScript/" class="nav-link"><i class="iconfont undefined"></i>
  JavaScript
</a></li><li class="dropdown-item"><!----> <a href="/categories/闲言碎语/" class="nav-link"><i class="iconfont undefined"></i>
  闲言碎语
</a></li></ul></div></div><div class="nav-item"><a href="/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/tools/" class="nav-link"><i class="iconfont reco-document"></i>
  收藏
</a></div><div class="nav-item"><a href="/photo/" class="nav-link"><i class="iconfont reco-douyin"></i>
  画廊
</a></div><div class="nav-item"><a href="/friends/" class="nav-link"><i class="iconfont reco-friend"></i>
  关于
</a></div><div class="nav-item"><a href="/timeLine/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>vue中使用vue-quill-editor富文本编辑器及自定义工具栏</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/views/vue/editor.html#前言" class="sidebar-link">前言</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/vue/editor.html#安装" class="sidebar-link">安装</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/vue/editor.html#引入" class="sidebar-link">引入</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/vue/editor.html#使用" class="sidebar-link">使用</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/vue/editor.html#效果" class="sidebar-link">效果</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/vue/editor.html#quilljs官网说明" class="sidebar-link">Quilljs官网说明</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/views/vue/editor.html#自定义工具栏参数项" class="sidebar-link">自定义工具栏参数项</a><ul class="sidebar-sub-headers"></ul></li></ul></section></li></ul> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-071f7da2 data-v-e3b9d544><h3 class="title" style="display:none;" data-v-071f7da2 data-v-071f7da2>vue中使用vue-quill-editor富文本编辑器及自定义工具栏</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-071f7da2 data-v-071f7da2><input type="password" value="" data-v-071f7da2> <span data-v-071f7da2>Konck! Knock!</span> <button data-v-071f7da2>OK</button></label> <div class="footer" style="display:none;" data-v-071f7da2 data-v-071f7da2><span data-v-071f7da2><i class="iconfont reco-theme" data-v-071f7da2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-071f7da2>vuePress-theme-reco</a></span> <span data-v-071f7da2><i class="iconfont reco-other" data-v-071f7da2></i> <a data-v-071f7da2>yykrlc</a></span> <span data-v-071f7da2><i class="iconfont reco-copyright" data-v-071f7da2></i> <a data-v-071f7da2>2021</a></span></div></div> <div data-v-e3b9d544><main class="page"><!----> <div class="page-title" style="display:none;"><h1>vue中使用vue-quill-editor富文本编辑器及自定义工具栏</h1> <hr> <div data-v-3cf1d7fb><i class="iconfont reco-account" data-v-3cf1d7fb><span data-v-3cf1d7fb>yykrlc</span></i> <i class="iconfont reco-date" data-v-3cf1d7fb><span data-v-3cf1d7fb>2019-12-20</span></i> <i class="iconfont reco-eye" data-v-3cf1d7fb><span id="/views/vue/editor.html" data-flag-title="Your Article Title" class="leancloud-visitors" data-v-3cf1d7fb><a class="leancloud-visitors-count" style="font-size:.9rem;font-weight:normal;color:#999;"></a></span></i> <i class="iconfont reco-tag tags" data-v-3cf1d7fb><span class="tag-item" data-v-3cf1d7fb>
      vue
    </span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><h2 id="前言"><a href="#前言" class="header-anchor">#</a> 前言</h2> <p>在Vue项目中使用vue-quill-editor富文本编辑器及编辑器自定义工具栏。</p> <h2 id="安装"><a href="#安装" class="header-anchor">#</a> 安装</h2> <p><code>yarn add vue-quill-editor --save</code></p> <h2 id="引入"><a href="#引入" class="header-anchor">#</a> 引入</h2> <div class="language-js line-numbers-mode"><pre class="language-js"><code>
<span class="token keyword">import</span> VueQuillEditor <span class="token keyword">from</span> <span class="token string">'vue-quill-editor'</span>
<span class="token comment">// vue-quill-editor 样式引入</span>
<span class="token keyword">import</span> <span class="token string">'quill/dist/quill.core.css'</span>
<span class="token keyword">import</span> <span class="token string">'quill/dist/quill.snow.css'</span>
<span class="token keyword">import</span> <span class="token string">'quill/dist/quill.bubble.css'</span>

Vue<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>VueQuillEditor<span class="token punctuation">)</span><span class="token punctuation">;</span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="使用"><a href="#使用" class="header-anchor">#</a> 使用</h2> <div class="language-html line-numbers-mode"><pre class="language-html"><code> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>template</span><span class="token punctuation">&gt;</span></span>
 	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-row</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-col</span> <span class="token attr-name">:span</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>20<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span> <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token style language-css"><span class="token property">margin</span><span class="token punctuation">:</span> 0px 12px 0px 10px</span><span class="token punctuation">&quot;</span></span></span><span class="token punctuation">&gt;</span></span>评分<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-rate</span>
              <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token style language-css"><span class="token property">display</span><span class="token punctuation">:</span> inline-block</span><span class="token punctuation">&quot;</span></span></span>
              <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>rateValue<span class="token punctuation">&quot;</span></span>
              <span class="token attr-name">show-score</span>
              <span class="token attr-name">text-color</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#ff9900<span class="token punctuation">&quot;</span></span>
              <span class="token attr-name">score-template</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>{value}<span class="token punctuation">&quot;</span></span>
            <span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-rate</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-col</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-col</span> <span class="token attr-name">:span</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>4<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>i</span>
              <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>el-icon-share<span class="token punctuation">&quot;</span></span>
              <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token style language-css"><span class="token property">color</span><span class="token punctuation">:</span> red<span class="token punctuation">;</span><span class="token property">display</span><span class="token punctuation">:</span> block<span class="token punctuation">;</span><span class="token property">margin-left</span><span class="token punctuation">:</span>65%</span><span class="token punctuation">&quot;</span></span></span>
              <span class="token punctuation">&gt;</span></span>收藏<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>i</span>
            <span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-col</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-row</span><span class="token punctuation">&gt;</span></span>
        
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>el-card</span><span class="token punctuation">&gt;</span></span>
           <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>评论<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
              <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>quill-editor</span>
                      <span class="token attr-name">v-model</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>content<span class="token punctuation">&quot;</span></span>
                      <span class="token attr-name">ref</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>myQuillEditor<span class="token punctuation">&quot;</span></span>
                      <span class="token attr-name">:options</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>editorOption<span class="token punctuation">&quot;</span></span>
                      <span class="token attr-name">@blur</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>onEditorBlur($event)<span class="token punctuation">&quot;</span></span>
                      <span class="token attr-name">@focus</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>onEditorFocus($event)<span class="token punctuation">&quot;</span></span>
                      <span class="token attr-name">@change</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>onEditorChange($event)<span class="token punctuation">&quot;</span></span>
              <span class="token punctuation">&gt;</span></span>
              <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>quill-editor</span><span class="token punctuation">&gt;</span></span>
          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>el-card</span><span class="token punctuation">&gt;</span></span>
       <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>template</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span><span class="token punctuation">&gt;</span></span><span class="token script"><span class="token language-javascript">
<span class="token keyword">import</span> <span class="token punctuation">{</span> quillEditor <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vue-quill-editor&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  name<span class="token operator">:</span> <span class="token string">&quot;InfoExperience&quot;</span><span class="token punctuation">,</span>
  <span class="token function">data</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
      rateValue<span class="token operator">:</span> <span class="token keyword">null</span><span class="token punctuation">,</span>
      rateStyle<span class="token operator">:</span> <span class="token punctuation">{</span>
        fontSize<span class="token operator">:</span> <span class="token string">&quot;35px&quot;</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      content<span class="token operator">:</span> <span class="token keyword">null</span><span class="token punctuation">,</span> <span class="token comment">// 初始编辑器内容</span>
      editorOption<span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span> <span class="token comment">// 编辑器配置项</span>
    <span class="token punctuation">}</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token function">created</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
  methods<span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token function">onEditorBlur</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token comment">//失去焦点事件</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token function">onEditorFocus</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token comment">//获得焦点事件</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token function">onEditorChange</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token comment">//内容改变事件</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">&gt;</span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>style</span> <span class="token attr-name">scoped</span><span class="token punctuation">&gt;</span></span><span class="token style"></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>style</span><span class="token punctuation">&gt;</span></span>

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br></div></div><h2 id="效果"><a href="#效果" class="header-anchor">#</a> 效果</h2> <p><img src="https://user-gold-cdn.xitu.io/2019/10/22/16df2ec81cadac30?w=1635&amp;h=385&amp;f=png&amp;s=35482" alt=""></p> <h1 id="自定义vue-quill-editor工具栏"><a href="#自定义vue-quill-editor工具栏" class="header-anchor">#</a> 自定义vue-quill-editor工具栏</h1> <h2 id="quilljs官网说明"><a href="#quilljs官网说明" class="header-anchor">#</a> Quilljs官网说明</h2> <p><a href="https://quilljs.com/docs/modules/toolbar/" target="_blank" rel="noopener noreferrer">官网说明 Toolbar Module<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <blockquote><p>The Toolbar module allow users to easily format Quill’s contents
It can be configured with a custom container and handlers.</p></blockquote> <blockquote><p>工具栏模块允许用户轻松格式化Quill的内容。
可以使用自定义container和 handlers进行配置。</p></blockquote> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token keyword">var</span> quill <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Quill</span><span class="token punctuation">(</span><span class="token string">'#editor'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
  modules<span class="token operator">:</span> <span class="token punctuation">{</span>
    toolbar<span class="token operator">:</span> <span class="token punctuation">{</span>
      container<span class="token operator">:</span> <span class="token string">'#toolbar'</span><span class="token punctuation">,</span>  <span class="token comment">// Selector for toolbar container</span>
      handlers<span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token string">'bold'</span><span class="token operator">:</span> customBoldHandler
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h2 id="自定义工具栏参数项"><a href="#自定义工具栏参数项" class="header-anchor">#</a> 自定义工具栏参数项</h2> <div class="language-js line-numbers-mode"><pre class="language-js"><code>      editorOption<span class="token operator">:</span> <span class="token punctuation">{</span>
        modules<span class="token operator">:</span> <span class="token punctuation">{</span>
          toolbar<span class="token operator">:</span>  <span class="token punctuation">[</span>
            <span class="token punctuation">[</span><span class="token string">'bold'</span><span class="token punctuation">,</span> <span class="token string">'italic'</span><span class="token punctuation">,</span> <span class="token string">'underline'</span><span class="token punctuation">,</span> <span class="token string">'strike'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>        <span class="token comment">// 加粗，斜体，下划线，删除线</span>
            <span class="token punctuation">[</span><span class="token string">'blockquote'</span><span class="token punctuation">,</span> <span class="token string">'code-block'</span><span class="token punctuation">]</span><span class="token punctuation">,</span>                      <span class="token comment">//引用，代码块</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'header'</span><span class="token operator">:</span> <span class="token number">1</span> <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">'header'</span><span class="token operator">:</span> <span class="token number">2</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>               <span class="token comment">// 几级标题</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'list'</span><span class="token operator">:</span> <span class="token string">'ordered'</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">'list'</span><span class="token operator">:</span> <span class="token string">'bullet'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>     <span class="token comment">// 有序列表，无序列表</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'script'</span><span class="token operator">:</span> <span class="token string">'sub'</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">'script'</span><span class="token operator">:</span> <span class="token string">'super'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>      <span class="token comment">// 下角标，上角标</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'indent'</span><span class="token operator">:</span> <span class="token string">'-1'</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">'indent'</span><span class="token operator">:</span> <span class="token string">'+1'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>          <span class="token comment">// 缩进</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'direction'</span><span class="token operator">:</span> <span class="token string">'rtl'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>                         <span class="token comment">// 文字输入方向</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'size'</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">'small'</span><span class="token punctuation">,</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token string">'large'</span><span class="token punctuation">,</span> <span class="token string">'huge'</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">// 字体大小</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'header'</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token boolean">false</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token comment">// 标题</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'color'</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">'background'</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>          <span class="token comment">// 颜色选择</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'font'</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token comment">// 字体</span>
            <span class="token punctuation">[</span><span class="token punctuation">{</span> <span class="token string">'align'</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 居中</span>
            <span class="token punctuation">[</span><span class="token string">'clean'</span><span class="token punctuation">]</span>                                         <span class="token comment">// 清除样式</span>
          <span class="token punctuation">]</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br></div></div><p>到这里，你只需要将需要的工具配置项加入<code>editorOption</code>中。你可以移除不需要的工具，让工具栏更加简洁，更多使用详见<a href="https://quilljs.com/docs/modules/toolbar/" target="_blank" rel="noopener noreferrer">【quilljs官网】<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></div> <footer class="page-edit" style="display:none;"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">6/29/2020, 3:45:05 PM</span></div></footer> <!----> <!----></main> <!----> <div class="comments-wrapper" data-v-e3b9d544><div class="valine-wrapper"><div id="valine"></div></div></div></div></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;background-color:rgba(231, 234, 241,.5);display:none;" data-v-44bd5a18 data-v-44bd5a18><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-44bd5a18><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-44bd5a18></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-44bd5a18></path></svg></div><div data-v-932dc3c2></div></div></div>
    <script src="/assets/js/app.f4a44a18.js" defer></script><script src="/assets/js/3.48232c0c.js" defer></script><script src="/assets/js/1.1ffd113d.js" defer></script><script src="/assets/js/49.fa7ab119.js" defer></script>
  </body>
</html>
